/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.cinfo.siga.ui.utils;

import org.jdesktop.beansbinding.Converter;

/**
 *
 * @author lartkma
 */
public class ShortToBooleanConverter extends Converter<Short, Boolean> {

    private static ShortToBooleanConverter that = null;

    private ShortToBooleanConverter() {
    }
    
    @Override
    public Boolean convertForward(Short value) {
        return value > 0;
    }

    @Override
    public Short convertReverse(Boolean value) {
        if (value) {
            return 1;
        } else {
            return 0;
        }
    }
    
    public static ShortToBooleanConverter get(){
        if(that == null) that = new ShortToBooleanConverter();
        return that;
    }
    
}
